#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;
void swap(int& x, int& y)
{
    int tmp = x;
    x = y;
    y = tmp;
}
void quikesort(int* arr, int left, int right)
{
    if (right <= left)
    {
        return;
    }
    int mid = arr[left];
    int begin = left;
    int end = right;
    while (begin <end)
    {
        while (arr[begin]<mid && begin < end)
        {
            begin++;
        }
        while (arr[end]>mid && begin < end)
        {
            end--;
        }
        swap(arr[end], arr[begin]);

    }
    //int mid = arr[left];
    //int i = left;
    //int count = 0;
    //for (i = left; i <= right; i++)
    //{
    //    if (arr[i] < mid)
    //    {
    //        count++;
    //    }
    //}
    //swap(arr[left], arr[count+left]);
    //int begin = left;
    //int end = right;
    //int midi = count;
    //while (begin < end)
    //{
    //    while (arr[begin] < arr[midi] && begin < end)
    //    {
    //        begin++;
    //    }
    //    while (arr[end] > arr[midi] && begin < end)
    //    {
    //        end--;
    //    }
    //    swap(arr[begin], arr[end]);
    //}
    quikesort(arr, left, begin - 1);
    quikesort(arr, begin+1 , right);
}
int main()
{
    int n;
    cin >> n;
    int* arr = new int[n];
    int i = 0;
    for (i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    quikesort(arr, 0, n - 1);
    for (i = 0; i < n; i++)
    {
        cout << arr[i] << " ";
    }
    return 0;
}